<? require_once '../../Include.php'; 
require_once '../../WEB_INF/SubmitConsulting/LiveScrum/ModConfig/Data/UsuarioData.php';
require_once '../../WEB_INF/SubmitConsulting/LiveScrum/ModConfig/Data/Entity/Usuario.php';
?>
<html>
<head>
    <title>Search</title>

</head>
<body onload='sf()'>
  <table align='center'>
    <tr><td align='center'>
        <input type='button' class='Btn' value='Nuevo' onclick='nuevo()'>
        </td></tr>
  </table>
<?
$go = trim($_POST['go']) ? trim($_POST['go']) : '';
$filter = trim($_POST['filter']) ? trim($_POST['filter']) : '';
$filter=str_replace(' ', '%', $filter);
$tran = new UsuarioData();
$row = $tran->listByFilter($filter);
try {
    if( count($row)>0 ) {
?>
  <table border='0' cellspacing='2' cellpadding='1' align='center'>
    <tr><th>Elegir</th></tr>
    <form action='UsuarioFm.php' method='post' name='resFm'>
        <input type='hidden' name='go' value='Editar'>
    <tr><td align='center'>
        <select name='usuarioId' size='10'>
            <?
            for( $i=0; $i < count($row); $i++ ) {
                $id=$row[$i]->getUsuarioId();
                echo '<option value='.$id.''; if($i==0) echo ' selected';
                echo '>';
                echo $row[$i]->getNombres().' ('. $id .')';
                echo '</option>';
            }
            ?>
        </select>
        </td></tr>
    <tr><td align='center'>
        <?= $i ?> Registros encontrados
        </td></tr>
    <tr><td align='center'>
        <input type='submit' class='btn' value='Continuar ->'>
        </td></tr>
    </form>
  </table>
<? }else
        echo '<br><br><b>B&uacute;squeda sin &eacute;xito, vuelva a intentar de la forma:</b>'.
         '<li>Basta colocar las iniciales del su nombre </li>'.
         '<br>p.e: <input type=text class=txt value=angel>'.
         '<br>';
}catch(Exception $e) {
    echo ('err:'.$e->getMessage());
}
?>
</body>
</html>
<form action='UsuarioFm.php' method='post' name='resFm2'>
    <input type='hidden' name='go' value=''>
</form>
<script type='text/javascript' language='JavaScript'><!--
    function nuevo(){
      document.resFm2.go.value='Crear';
      document.resFm2.submit();
    }
    function enter() {
        if (window.event) keycd = window.event.keyCode;
        else if (evnt && evnt.which) keycd = evnt.which;
        else return ;
        if (keycd==13)
            document.resFm.submit();
    }
    if (document.captureEvents) {
        document.captureEvents(Event.KEYPRESS);
        document.onkeypress = enter;
    }
<? if($i>0) echo 'document.resFm.usuarioId.onkeyup = enter;'; ?>
    function sf() {
<? if($i>0) echo 'document.resFm.usuarioId.focus();'; ?>
    }
// --></script>



